#include "stdafx.h"
#include "materialeditor.h"
#include <QtGui/QApplication>

namespace Lit
{
	namespace Editor
	{
		class Settings
		{
			QSettings		mSettings;
			std::string		mLocale;

		public:
			Settings( const std::string &organisation, const std::string &software )
				: mSettings(QSettings::NativeFormat, QSettings::SystemScope, TO_QT(organisation), TO_QT(software) )
				, mLocale( FROM_QT(QLocale::system().name().section('_', 0, 0)) )
			{  }
			~Settings( ){}
				
			std::string				getApplicationName() const{ return FROM_QT(mSettings.applicationName()); }
			const std::string&		getLocale() const{ return mLocale; }

		};
	};
};
int main(int argc, char *argv[])
{
	Lit::Editor::Settings s( "DarkSofts", "MaterialEditor" ); 
	QApplication app(argc, argv);
	app.setStyle(new QWindowsVistaStyle());
	Lit::FileSystem::_setApplicationPath( FROM_QT(app.applicationDirPath()) );
	
    QTranslator translator;
	translator.load(QString("%1/materialeditor_%2").arg(TO_QT(Lit::FileSystem::applicationPath())).arg(TO_QT(s.getLocale())));
    app.installTranslator(&translator);
	app.setApplicationVersion( PROJECT_VERSION_STRING );

	Lit::Editor::MaterialEditor w(true);
	w.show();
	return app.exec();
}
